// JavaScript Documentfunction notEmpty(elem, helperMsg){
function notEmpty(elem, helperMsg){

	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max,helpmsg){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert(helpmsg);
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Select"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
			}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function emptyLengthrestrict(elem, minx,maxx,helperMsg){
         var uInput = elem.value;
		   
	if(!(uInput .length == 0)){
		          
		           if(uInput.length >= minx && uInput.length <= maxx){
		                   return true;
	                  }else{
		                    alert(helperMsg);
		                    elem.focus();
		                    return false;
	                    }
		
		
	}else{
		
		return true; 
		}
	
}


function emptyNumeric(elem,helperMsg){
         if(!(elem.value.length == 0)){
		 var numericExpression = /^[0-9]+$/;
			     if(elem.value.match(numericExpression)){
		                     return true;
	              }else{
		              alert(helperMsg);
		              elem.focus();
		              return false;
	              }
			 
	
	    }else{
		
		return true; 
		}
	
	}
	
	function emptyEmail(elem,helperMsg){
         if(!(elem.value.length == 0)){
		            var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	              if(elem.value.match(emailExp)){
		              return true;
	              }else{
		             alert(helperMsg);
		             elem.focus();
		             return false;
	                  }
	
	    }else{
		     
		return true; 
		}
	
	}
	

	function emptyString(elem,helperMsg){
         if(!(elem.value.length == 0)){
		            
	             var alphaExp = /^[a-zA-Z]+$/;
	             if(elem.value.match(alphaExp)){
		               return true;
	             }else{
		               alert(helperMsg);
		               elem.focus();
		               return false;
	}
	    }else{
		     
		return true; 
		}
	
	}


//function madeRadioSelection(elem, helperMsg){
	//if ( ( elem.value[0].checked == false ) && ( elem.value[1].checked == false ) ) 
	//{
		//alert(helperMsg);
		//elem.focus();
		//return false;
	//}else{
		//return true;
	//}
//}



//function madeRadioSelection(elem,helperMsg)  
    //{  
    //x=0;  
    //if(elem.checked)   
    ///{  
    //x++;  
    //}
    //if(x==0)  
    //{  
    //alert(helperMsg); 
    //elem.focus();  
    //return false;  
    //}  
    //else  
    //{  
      //  return true;
	//}  
    //}  
	
	
	
	
	// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
//function madeRadioSelection(elem,helperMsg) {
    //var cnt = -1;
    //for (var i=elem.length-1; i > -1; i--) {
      //  if (elem[i].checked) {cnt = i; i = -1;}
    //}
    //if (cnt > -1) return elem[cnt].value;
    //else return null;
//}

//function madeRadioSelection(elem, helperMsg){
//ErrorText= "";
//if ( ( myForm.sltGen[0].checked == false ) && ( myForm.sltGen[1].checked == false ) )
//{
	//alert ( "Please choose your Gender: Male or Female" );
	//return false; 
	//}
//if (ErrorText= "") 
//{ 
//return true;
//form.submit()
//}
//}

function madeRadioSelection(){
	if(document.getElementById("sltGen1").checked || document.getElementById("sltGen2").checked){
		//alert("selected");
		return true;
	}
	alert("Please select your gender");
	//elem.focus();
	return false;
}
